package com.sl.au.repository;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import com.sl.au.entity.EXDEgetPayDetailHistoryWithContract;

@Transactional(readOnly = true)
/*public interface EXDEgetPayDetailHistoryWithContractRepositor extends JpaRepositoryFactory<EXDEgetPayDetailHistoryWithContract, String>{
	@Query(" select * from getPayDetailHistoryWithContract")
	Page<EXDEgetPayDetailHistoryWithContract> findVisitCost(String id,Pageable pageable);
}1*/
public interface EXDEgetPayDetailHistoryWithContractRepositor extends JpaRepository<EXDEgetPayDetailHistoryWithContract, String> {
	
	@Query("select p from EXDEgetPayDetailHistoryWithContract p where p.sContractType=?2 and p.superior=?1")
	Page<EXDEgetPayDetailHistoryWithContract> findAllTrance(String superior,String sContractType,Pageable pageable);
	
	@Query("select count(*) from EXDEgetPayDetailHistoryWithContract p where p.sContractType=?2 and p.superior=?1")
	long findAllTrancegetCount(String superior,String sContractType);
	
	@Query("select p from EXDEgetPayDetailHistoryWithContract p where p.sContractType=?2 and p.superior=?1 and (p.cPaidType like '%'+?3+'%' or p.sFund like '%'+?3+'%')")
	Page<EXDEgetPayDetailHistoryWithContract> findAllTrance(String superior,String sContractType,String key,Pageable pageable);
	
	@Query("select count(*) from EXDEgetPayDetailHistoryWithContract p where p.sContractType=?2 and p.superior=?1 and (p.cPaidType like '%'+?3+'%' or p.sFund like '%'+?3+'%')")
	long findAllTrancegetCount(String superior,String sContractType,String key);
	
	
}

